package io.renren.modules.work.service.impl;

import io.renren.modules.work.dao.ScStockDao;
import io.renren.modules.work.entity.ScStockEntity;
import io.renren.modules.work.service.ScStockService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;



@Service("scStockService")
public class ScStockServiceImpl extends ServiceImpl<ScStockDao, ScStockEntity> implements ScStockService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<ScStockEntity> scStockEntityQueryWrapper = new QueryWrapper<>();
        if(StringUtils.isNotBlank((String) params.get("goodsname"))){
            scStockEntityQueryWrapper.like("goodsname",params.get("goodsname"));
        }
        IPage<ScStockEntity> page = this.page(
                new Query<ScStockEntity>().getPage(params),
                scStockEntityQueryWrapper
        );

        return new PageUtils(page);
    }

}